#ifndef NETFUN_H
#define NETFUN_H

#include <QObject>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QNetworkAccessManager>

class NetFun : public QObject
{
    Q_OBJECT
public:
    explicit NetFun(QObject *parent = nullptr);
    Q_INVOKABLE void sendPost(QString sendStr);
public slots:
    void finishedSlot(QNetworkReply*);
signals:
private:
    QNetworkAccessManager *m_accessManager;
};

#endif // NETFUN_H

//QNetworkRequest request;
//QNetworkAccessManager* naManager = new QNetworkAccessManager(this);
//QMetaObject::Connection connRet = QObject::connect(naManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(requestFinished(QNetworkReply*)));
//Q_ASSERT(connRet);

//request.setUrl(QUrl("https://www.baidu.com"));

//QString testData = "test";
//QNetworkReply* reply = naManager->post(request, testData.toUtf8());
